<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    //三个变量 上上个 上一个 当前的
    function fn(n) {
        if (n <= 1) {
            return n
        }
        let a = 0, b = 1, temp
        for (let i = 2; i < n; i++) {
            temp = a + b
            a = b
            b = temp
        }
        return b
    }
    console.log(fn(11));

</script>

</html>